<form id="queryForm" style="margin: 1em;" action="<{u('Game/getUserList')}>" method="post" target="_blank">
    <div class="row" style="margin: 1em">
        <div class="col-sm-2">
        <div class="col-sm-6" style="padding-left: 5px;padding-right: 5px"><input type="text" id="gameDate" name="begin" class="form-control" placeholder="开始时间" ></div>
        <div class="col-sm-6" style="padding-left: 5px;padding-right: 5px"><input type="text" id="gameDate2" name="end" class="form-control" placeholder="结束时间" ></div>
        </div>
        <div class="col-sm-1"><input type="text" id="userid" name="userid" class="form-control" placeholder="用户编号"></div>
        <div class="col-sm-1"><input type="text" id="agent" name="agent"  <{if $agent gt 0}>  value="<{$agent}>" <{/if}>  class="form-control" placeholder="代理编号"></div>
        <div class="col-sm-1"><input type="button" id="userSearch" class="btn btn-primary" value="查询"></div>
        <div class="col-sm-1"><input type="button" id="userExport" class="btn btn-primary" value="导出"></div>导出操作需大量计算，请耐心等待结果
        <input type="hidden" name="export" id="exportField" />

    </div>
</form>


<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <div class="box-name">
                    <i class="fa fa-table"></i>
                    <span>用户查询</span>
                </div>
                <div class="box-icons">
                    <a class="collapse-link">
                        <i class="fa fa-chevron-up"></i>
                    </a>
                    <a class="expand-link">
                        <i class="fa fa-expand"></i>
                    </a>

                </div>
                <div class="no-move"></div>
            </div>
            <div class="box-content no-padding">
                <table class="table table-striped table-bordered table-hover table-heading no-border-bottom">
                    <thead>
                    <tr>
                        <th>用户ID</th>
                        <th>用户昵称</th>
                        <th>注册时间</th>
                        <th>绑定手机</th>
                        <th>代理</th>
                        <th>被绑定时间</th>
                        <th>充值金额</th>
                        <th>消耗钻石</th>
                        <th>剩余钻石</th>
                        <th>参与牌局数</th>
                        <th>开房总数</th>
                        <th>3局开房数</th>
                        <th>6局开房数</th>
                        <th>9局开房数</th>
                    </tr>
                    </thead>
                    <tbody id="dataContent">
                    <{include file="UserCount_data.html" }>
                    </tbody>
                </table>
                <div id="footer">
                    <{include file="pager.html" }>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="/Public/My97DatePicker/WdatePicker.js"></script>
<script>
    var tipIndex=0;

    $(document).ready(
            function(){
                $('#userSearch').click(function(){
                    query(1);
                });
                $('#userExport').click(function(){
                    $('#exportField').val(1);
                    $('#queryForm').submit();
                });
            }
    );



    function query(page){
        if(!page)page=1;
        $('#exportField').val(0);
        var data=$("#queryForm").serialize()+"&page="+page+"&query=1";

        var tipIndex = layer.load(1, {
            shade: [0.1,'#fff'] //0.1透明度的白色背景
        });
        $.post("<{U('Game/getUserList')}>",data,function(re){
            layer.close(tipIndex)
            if(re.status==0){
                $('#dataContent').html(re.html);
                $('#footer').html(re.page);
                return;
            }else{
                alert(re.msg);
            }

        },'JSON');
    }

    function page(toPage){
        query(toPage);
    }

    function jump(){
        query($('#jp').val());
    }




    /**
     * 日期联动
     * @param start
     * @param end
     */
    function datePickter(start,end,isDate){
        if(isDate){
            dateFmt='yyyy-MM-dd';
        }else{
            dateFmt='yyyy-MM-dd HH:mm';
        }
        if( end !== undefined && end ) {
            $("#"+start).focus(function(){
                WdatePicker({
                    onpicked:function(){
                        $("#"+end).focus()
                    },
                    maxDate:'#F{$dp.$D('+end+')}',
                    dateFmt:dateFmt
                })
            });
            $("#" + end).focus(function () {
                WdatePicker({
                    dateFmt: dateFmt,
                    minDate: '#F{$dp.$D(' + start + ')}'
                })
            });
        }else {
            $("#"+start).focus(function(){
                WdatePicker({dateFmt:dateFmt});
            });
        }
    }
    datePickter('gameDate','gameDate2',true);

</script>

